<template>
    <v-details :detailData="inputData" :inputConfig="inputConfig" :rules="rules" @pop="setdata"
               ref="input"></v-details>
</template>

<script>
import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
    props: {
        inputData: {
            type: Object,
        }
    },
    mixins: [baseMixin],
    name: "OrdersTitle",
    data() {
        return {

            rules: {},
        }
    },
    computed: {
        inputConfig() {
            return [
                [
                    {
                        type: "select",
                        label: this.$t('bill.invoiceType'),
                        props: "invoice_type",
                        options: this.getOptions("getSelectCode/INVOICE_TYPE/INV_TYPE_DESC/BIC_CODE_INVTYPE/language='zh'")
                    },
                    {
                        type: "table",
                        label: this.$t('bill.activity'),
                        props: "activity_id",
                        tableConfig: [
                            {
                                label: this.$t('bill.activity'),
                                prop: "activity_id",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "activity_desc",
                                input: "input",
                            }
                        ],
                        url: `/queryActivityList/${this.$store.state.wms}/`
                    },
                    {
                        type: "table",
                        label: this.$t('bill.chargeCode'),
                        props: "charge_code",
                        tableConfig: [
                            {
                                label: this.$t('bill.chargeCode'),
                                prop: "charge_code",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "charge_desc",
                                input: "input",
                            },
                        ],
                        url: `/queryChargeCodeList/`
                    },
                    {
                        type: "table",
                        label: "账单计量单位",
                        props: "bill_uom",
                        tableConfig: [
                            {
                                label: "计量单位代码",
                                prop: "uom_code",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "uom_desc",
                                input: "input",
                            },
                            {
                                label: "计量单位类型",
                                prop: "uom_type_code",
                                input: "select",
                                options: this.getOptions("codelkup/UOMTYPE")
                            },
                            {
                                label: "字段百分比",
                                prop: "per_of_field",
                                input: "input",
                            },
                            {
                                label: "计量系统",
                                prop: "measure_code",
                                input: "select",
                                options: this.getOptions("codelkup/MEASURESYS")
                            },
                            {
                                label: this.$t('config.measureUnit'),
                                prop: "measure_uom",
                                input: "input",
                            },
                        ],
                        url: `/queryUomList/`
                    },
                    {
                        type: "checkbox",
                        label: "复审费用",
                        props: "review_flag",
                    },
                ],
                [
                    {
                        type: "table",
                        label: this.$t('bill.billTo'),
                        props: "bill_to",
                        tableConfig: [
                            {
                                label: this.$t('bill.billTo'),
                                prop: "bill_to_cust",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "name",
                                input: "input",
                            },
                        ],
                        url: `/queryBillToList/${this.$store.state.wms}/`
                    },
                    {
                        type: "select",
                        label: "账单级",
                        props: "bill_level",
                        options: this.getOptions("getSelectCode/BILL_LEVEL/LEVEL_DESC/BIC_CODE_BILLEVEL/language='zh'")
                    },
                    {
                        type: "table",
                        label: "特殊",
                        props: "event_special",
                        tableConfig: [
                            {
                                label: "特殊事件",
                                prop: "event_special",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "special_desc",
                                input: "input",
                            },
                            {
                                label: this.$t('bill.invoiceType'),
                                prop: "invoice_type",
                                input: "select",
                                options: this.getOptions("getSelectCode/INVOICE_TYPE/INV_TYPE_DESC/BIC_CODE_INVTYPE/language='zh'")
                            },
                            {
                                label: "活动ID",
                                prop: "activity_id",
                                input: "input",
                            },
                            {
                                label: "账单级",
                                prop: "bill_level",
                                input: "input",
                            },
                        ],
                        url: `/queryEventSpecList/${this.inputData.invoice_type}/${this.$store.state.wms}/`
                    },
                    {
                        type: "select",
                        label: "省略零发货量",
                        props: "omit_zero_qty",
                        options: this.getOptions("codelkup/ISCLOSE")
                    },
                ],
                [
                    {
                        type: "input",
                        label: "分割",
                        props: "percent_of_rate",
                    },
                    {
                        type: "table",
                        label: "期段",
                        props: "of_period",
                        tableConfig: [
                            {
                                label: "期段",
                                prop: "period_code",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "period_desc",
                                input: "input",
                            }
                        ],
                        url: `/queryPeriodList/`
                    },
                    {
                        type: "input",
                        label: "宽限频率",
                        props: "grace_freq",
                    },
                    {
                        type: "table",
                        label: "宽限期",
                        props: "grace_period",
                        tableConfig: [
                            {
                                label: "期段",
                                prop: "period_code",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "period_desc",
                                input: "input",
                            }
                        ],
                        url: `/queryPeriodList/`
                    },
                ],
                [
                    {
                        type: "input",
                        label: "重复性账单自",
                        props: "from_an",
                        disabled: true
                    },
                    {
                        type: "input",
                        label: "重复性账单至",
                        props: "to_an",
                        disabled: true
                    },
                    {
                        type: "input",
                        label: "重复项账单处理规则",
                        props: "recur_code",
                        disabled: true
                    },
                ]
            ]
        }
    },
    methods: {
        setdata(data, id, close, listId) {
            if (listId == '0' && id == "1") {
                this.inputData.activity_id = data.activity_id;
            } else if (listId == "0" && id == "2") {
                this.inputData.charge_code = data.charge_code;
            } else if (listId == "0" && id == "3") {
                this.inputData.bill_uom = data.uom_code;
            } else if (listId == "1" && id == "0") {
                this.inputData.bill_to = data.bill_to_cust;
            } else if (listId == "1" && id == "2") {
                this.inputData.event_special = data.event_special;
            } else if (listId == "2" && id == '1') {
                this.inputData.of_period = data.period_code;
            } else if (listId == "2" && id == '3') {
                this.inputData.grace_period = data.period_code;
            }
            close(false);
        }
    },
    mounted() {

    },
    watch: {},
    components: {
        'v-details': details
    }
}
</script>

<style scoped>

</style>
